<!--#include file="Include/Config2.asp"-->
<%
'----------------------------------------------------------
'页面功能：问卷显示页的一个分支,用于配合AJAX实现截断跳转类型题目的显示，本站核心文件。
'最后修改时间：2007-12-05 13时40分
'作者：legal http://www.ilegal.cn
'备注：
'----------------------------------------------------------
Dim Survey_id,Action
Survey_id=request.QueryString("Survey_id")
Action=request.QueryString("Action")'
Question_id=request.Form("Question_id")'上一道题目的ID
Question_view_num=cint(request.Form("Question_view_num"))'显示的第几个题目
Call CheckNum(Survey_id)
Call CheckNum(Question_id)
'Call Debug("<a href=""http://www.baidu.com"">ddd</a>")
if Survey_id="" or Action="" then
    Call Show_Err
else
	sql="select * from survey where Survey_id="&Survey_id
	rs.open sql,conn,1,3
	if rs.eof then
		Call Show_Err
	else
		Survey_content=rs("Survey_content")
		Survey_jdtz=rs("Survey_jdtz")
	end if
	rs.close
end if
if Survey_content="" then'对于没有题目的问卷的过滤
	Call Show_Err
end if
'----------------------------------------------------------
'根据Action调用各种过程。
'----------------------------------------------------------
Select Case Action
    Case "" Call Show_Err
    Case "Show_Question" Call Show_Question
    Case "Save_Survey" Call Save_Survey
    Case "Save_Survey" Call Save_Survey
End Select
'----------------------------------------------------------
'显示问卷题目
'----------------------------------------------------------
Sub Show_Question
    if Question_id=0 then
	    Survey_content_arr=split(Survey_content,",")
		Call Show_Question_Single(Survey_content_arr(0),1,0)
	else
	    Question_type=cint(request.Form("Question_type"))
	    Survey_content_arr=split(Survey_content,",")
							
	    if Survey_content_arr(0)=Question_id then
		    response.Cookies("Survey_Jdtz")("Survey_id")=Survey_id
		    response.Cookies("Survey_Jdtz")("Question_list")=Question_id
		    response.Cookies("Survey_Jdtz")("Question_type")=Question_type
			'---------------------------------------------------
			Dim Next_Question
			Dim Question_Result_arrString
			Select Case Question_type'获取上一道结果，连接成字符串，同时得到下一题
			Case "1","2"
			Dim have,Question_jdtz,Question_jdtz_arr
			Dim value_d:value_d=request.Form("answer"&Question_id)
			if value_d="" then
			Call ShowAlert("请先填写完整","")
			end if
			sqlstr="select Question_jdtz from question where Question_id="&Question_id
			rst.open sqlstr,conn,1,1
			have=0'判断题目是否有有效截断跳转
			if rst("Question_jdtz")<>"" then
				Question_jdtz=rst("Question_jdtz")
				Question_jdtz_arr=split(Question_jdtz,"&")
				for j=0 to ubound(Question_jdtz_arr)
					if Question_jdtz_arr(j)<>"null" then
						have=1
						exit for
					end if
				next
			else
			have=0
			end if
			rst.close
			if have then'有跳转，则先保存结果，再根据结果
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，则是多项选择题型的处理
						value_d=split(value_d,",")
						for each val in value_d
							if Question_Result_arrString<>"" then
								Question_Result_arrString=Question_Result_arrString&"$$$$"&val
							else
								Question_Result_arrString=val
							end if
							if Question_jdtz_arr(val)="over" then'有截断跳转--多选题型得到下一题
							Next_Question="over"
							else
								 if Question_jdtz_arr(val)="null" then
								 else
									Next_Question=Question_jdtz_arr(val)
								 end if 
							end if
						next
					else
					    Question_Result_arrString=value_d
						if Question_jdtz_arr(value_d)<>"over" then'有截断跳转--单选得到下一题
							if Question_jdtz_arr(value_d)<>"null" then
							Next_Question=Question_jdtz_arr(value_d)
							end if 
						else
							Next_Question="over"
						end if
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
				if Next_Question="" then'虽然是截断跳转，但用户的选择并不需要跳转
					if ubound(Survey_content_arr)<1 then'无截断跳转--不管单选还是多选得到下一题
					Next_Question="over"
					else
					Next_Question=Survey_content_arr(1)
					end if
				end if
			else'无跳转，保存结果，选择下一题即可
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，则是多项选择题型的处理
						value_d=split(value_d,",")
						for each val in value_d
							if Question_Result_arrString<>"" then
								Question_Result_arrString=Question_Result_arrString&"$$$$"&val
							else
								Question_Result_arrString=val
							end if	
						next
					else
					Question_Result_arrString=value_d
					end if
					if ubound(Survey_content_arr)<1 then'无截断跳转--不管单选还是多选得到下一题
					Next_Question="over"
					else
					Next_Question=Survey_content_arr(1)
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
			end if
			Case "3","4"
			'Dim have,Question_jdtz,Question_jdtz_arr
			value_d=request.Form("answer"&Question_id)
			sqlstr="select Question_result,Question_jdtz from question where Question_id="&Question_id
			rst.open sqlstr,conn,1,1
			Question_answer_length=ubound(rs("Question_result"))
			have=0'判断题目是否有有效截断跳转
			if rst("Question_jdtz")<>"" then
				Question_jdtz=rs("Question_jdtz")
				Question_jdtz_arr=split(Question_jdtz,"&")
				for j=0 to ubound(Question_jdtz_arr)
					if Question_jdtz_arr(j)<>"null" then
						have=1
						exit for
					end if
				next
			else
			have=0
			end if
			rst.close
			if have then'有跳转，则先保存结果，再根据结果
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，是对多项选择+自定义文本的处理
						dim sqlstr,Question_answer_length
						value_d=split(value_d,",")
						for i=0 to ubound(value_d)
							if Question_answer_length<>value_d(i) then
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&value_d(i)
								else
									Question_Result_arrString=value_d(i)&"::::"&value_d(i)
								end if
							else
								text_temp=replace(request.Form("answer"&Question_id&"_2"),"::::","")
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&text_temp
								else
									Question_Result_arrString=value_d(i)&"::::"&text_temp
								end if
							end if
							if Question_jdtz_arr(value_d(i))="over" then'有截断跳转--多选+自定义文本题型得到下一题
							Next_Question="over"
							else
								 if Question_jdtz_arr(value_d(i))="null" then
								 else
									Next_Question=Question_jdtz_arr(value_d(i))
								 end if 
							end if
						next
					else
						Question_Result_arrString=value_d&"::::"&value_d
						if Question_jdtz_arr(value_d)="over" then'有截断跳转--单选+自定义文本得到下一题
						Next_Question="over"
						else
							 if Question_jdtz_arr(value_d)="null" then
							 else
								Next_Question=Question_jdtz_arr(value_d)
							 end if 
						end if
						if Next_Question="" then'虽然是截断跳转，但用户的选择并不需要跳转
							if ubound(Survey_content_arr)<1 then'无截断跳转--不管单选还是多选得到下一题
							Next_Question="over"
							else
							Next_Question=Survey_content_arr(1)
							end if
						end if
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
			else
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，是对多项选择+自定义文本的处理
						'dim sqlstr,Question_answer_length
						value_d=split(value_d,",")
						for i=0 to ubound(value_d)
							if Question_answer_length<>value_d(i) then
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&value_d(i)
								else
									Question_Result_arrString=value_d(i)&"::::"&value_d(i)
								end if
							else
								text_temp=replace(request.Form("answer"&Question_id&"_2"),"::::","")
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&text_temp
								else
									Question_Result_arrString=value_d(i)&"::::"&text_temp
								end if
							end if
						next
					else
					Question_Result_arrString=value_d&"::::"&value_d
					end if
					if ubound(Survey_content_arr)<1 then'无截断跳转--不管单选还是多选得到下一题
					Next_Question="over"
					else
					Next_Question=Survey_content_arr(1)
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
            end if
			Case "5"
			Question_Result_arrString=request.Form("answer"&Question_id)
			if ubound(Survey_content_arr)<1 then'无截断跳转--不管单选还是多选得到下一题
			Next_Question="over"
			else
			Next_Question=Survey_content_arr(1)
			end if			
			End Select
			'---------------------------------------------------
		    response.Cookies("Survey_Jdtz")("Question_result")=Question_Result_arrString
			if Next_Question<>"over" then
			    if Survey_content_arr(ubound(Survey_content_arr))=Next_Question then
				    Call Show_Question_Single(Next_Question,Question_view_num+1,1)
				else
				    Call Show_Question_Single(Next_Question,Question_view_num+1,0)	
				end if
			else
				Call Save_Survey
				response.End()
			end if
		else'不是第一个的问卷题目处理
		    Question_id_subscript=Get_Subscript(Question_id,Survey_content_arr)'上一道题目在Survey_content_arr中的下标
			response.Cookies("Survey_Jdtz")("Question_list")=request.Cookies("Survey_Jdtz")("Question_list")&"||||"&Question_id
		    response.Cookies("Survey_Jdtz")("Question_type")=request.Cookies("Survey_Jdtz")("Question_type")&"||||"&Question_type
			'---------------------------------------------------
			Select Case Question_type'获取上一道结果成字符串，同时得到下一题
			Case "1","2"
			value_d=request.Form("answer"&Question_id)
			if value_d="" then
			Call ShowAlert("请先填写完整","")
			end if
			sqlstr="select Question_jdtz from question where Question_id="&Question_id
			rst.open sqlstr,conn,1,1
			have=0'判断题目是否有有效截断跳转
			if rst("Question_jdtz")<>"" then
				Question_jdtz=rst("Question_jdtz")
				Question_jdtz_arr=split(Question_jdtz,"&")
				for j=0 to ubound(Question_jdtz_arr)
					if Question_jdtz_arr(j)<>"null" then
						have=1
						exit for
					end if
				next
			else
			have=0
			end if
			rst.close
			if have then'有跳转，则先保存结果，再根据结果
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，则是多项选择题型的处理
						value_d=split(value_d,",")
						for each val in value_d
							if Question_Result_arrString<>"" then
								Question_Result_arrString=Question_Result_arrString&"$$$$"&val
							else
								Question_Result_arrString=val
							end if
							if Question_jdtz_arr(val)="over" then'有截断跳转--多选题型得到下一题
							Next_Question="over"
							else
								 if Question_jdtz_arr(val)="null" then
								 else
									Next_Question=Question_jdtz_arr(val)
								 end if 
							end if
						next
					else
					    Question_Result_arrString=value_d
						if Question_jdtz_arr(value_d)<>"over" then'有截断跳转--单选得到下一题
							if Question_jdtz_arr(value_d)<>"null" then
							Next_Question=Question_jdtz_arr(value_d)
							end if 
						else
							Next_Question="over"
						end if
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
				if Next_Question="" then'虽然是截断跳转，但用户的选择并不需要跳转
					if ubound(Survey_content_arr)<Question_id_subscript+1 then'无截断跳转--不管单选还是多选得到下一题
					Next_Question="over"
					else
					Next_Question=Survey_content_arr(Question_id_subscript+1)
					end if
				end if
			else'无跳转，保存结果，选择下一题即可
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，则是多项选择题型的处理
						value_d=split(value_d,",")
						for each val in value_d
							if Question_Result_arrString<>"" then
								Question_Result_arrString=Question_Result_arrString&"$$$$"&val
							else
								Question_Result_arrString=val
							end if	
						next
					else
					Question_Result_arrString=value_d
					end if
					if ubound(Survey_content_arr)<Question_id_subscript+1 then'无截断跳转--不管单选还是多选得到下一题
					Next_Question="over"
					else
					Next_Question=Survey_content_arr(Question_id_subscript+1)
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
			end if
			Case "3","4"
			'Dim have,Question_jdtz,Question_jdtz_arr
			value_d=request.Form("answer"&Question_id)
			sqlstr="select Question_result,Question_jdtz from question where Question_id=" & Question_id
			rst.open sqlstr,conn,1,1
			Question_answer_length=ubound(split(rst("Question_result"),","))
			have=0'判断题目是否有有效截断跳转
			if rst("Question_jdtz")<>"" then
				Question_jdtz=rst("Question_jdtz")
				Question_jdtz_arr=split(Question_jdtz,"&")
				for j=0 to ubound(Question_jdtz_arr)
					if Question_jdtz_arr(j)<>"null" then
						have=1
						exit for
					end if
				next
			else
			have=0
			end if
			rst.close
			if have then'有跳转，则先保存结果，再根据结果
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，是对多项选择+自定义文本的处理
						value_d=split(value_d,",")
						for i=0 to ubound(value_d)
							if Question_answer_length<>value_d(i) then
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&value_d(i)
								else
									Question_Result_arrString=value_d(i)&"::::"&value_d(i)
								end if
							else
								text_temp=replace(request.Form("answer"&Question_id&"_2"),"::::","")
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&text_temp
								else
									Question_Result_arrString=value_d(i)&"::::"&text_temp
								end if
							end if
							if Question_jdtz_arr(value_d(i))="over" then'有截断跳转--多选+自定义文本题型得到下一题
							Next_Question="over"
							else
								 if Question_jdtz_arr(value_d(i))="null" then
								 else
									Next_Question=Question_jdtz_arr(value_d(i))
								 end if 
							end if
						next
					else
						Question_Result_arrString=value_d&"::::"&value_d
						if Question_jdtz_arr(value_d)="over" then'有截断跳转--单选+自定义文本得到下一题
						Next_Question="over"
						else
							 if Question_jdtz_arr(value_d)="null" then
							 else
								Next_Question=Question_jdtz_arr(value_d)
							 end if 
						end if
						if Next_Question="" then'虽然是截断跳转，但用户的选择并不需要跳转
							if ubound(Survey_content_arr)<Question_id_subscript+1 then'无截断跳转--不管单选还是多选得到下一题
							Next_Question="over"
							else
							Next_Question=Survey_content_arr(Question_id_subscript+1)
							end if
						end if
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
			else
				if value_d<>"" then
					if len(value_d)>1 then'对于返回是数组的返回值，是对多项选择+自定义文本的处理
						'dim sqlstr,Question_answer_length
						value_d=split(value_d,",")
						for i=0 to ubound(value_d)
							if Question_answer_length<>value_d(i) then
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&value_d(i)
								else
									Question_Result_arrString=value_d(i)&"::::"&value_d(i)
								end if
							else
								text_temp=replace(request.Form("answer"&Question_id&"_2"),"::::","")
								if Question_Result_arrString<>"" then
									Question_Result_arrString=Question_Result_arrString&"$$$$"&value_d(i)&"::::"&text_temp
								else
									Question_Result_arrString=value_d(i)&"::::"&text_temp
								end if
							end if
						next
					else
					Question_Result_arrString=value_d&"::::"&value_d
					end if
					if ubound(Survey_content_arr)<Question_id_subscript+1 then'无截断跳转--不管单选还是多选得到下一题
					Next_Question="over"
					else
					Next_Question=Survey_content_arr(Question_id_subscript+1)
					end if
				else
					Call ShowAlert("请先完成上一道题","")	
				end if
            end if
			Case "5"
			Question_Result_arrString=request.Form("answer"&Question_id)
			if ubound(Survey_content_arr)<Question_id_subscript+1 then'无截断跳转--不管单选还是多选得到下一题
			Next_Question="over"
			else
			Next_Question=Survey_content_arr(Question_id_subscript+1)
			end if			
			End Select
			'---------------------------------------------------
		    response.Cookies("Survey_Jdtz")("Question_result")=request.Cookies("Survey_Jdtz")("Question_result")&"||||"&Question_Result_arrString
			if Next_Question<>"over" then
			    if Survey_content_arr(ubound(Survey_content_arr))=Next_Question then
				    Call Show_Question_Single(Next_Question,Question_view_num+1,1)
				else
				    Call Show_Question_Single(Next_Question,Question_view_num+1,0)	
				end if
			else
				Call Save_Survey
				response.End()
			end if
		end if
	end if
End Sub
'----------------------------------------------------------
'根据题目ID显示问卷单个题目,参数：题目的ID，第几个题目,按钮类型(0 and 1)
'----------------------------------------------------------
Sub Show_Question_Single(Question_id,Order_num,menu_Types)
sql="select * from question where Question_id=" & Question_id
rs.open sql,conn,1,1
if not rs.eof then
select case rs("Question_type")
case "1"
	I1 "<div id=""Question_item"&Question_id&""">"
		I1 "<form id=""QuestionForm"" action=""Survey_Show_Jdtz.asp?Survey_id="&Survey_id&"&Action=Show_Question"" method=""post"" onsubmit=""to_submit();"">"
		I1 "<input name=""Question_id"" type=""hidden"" value="""&Question_id&"""/>"
		I1 "<input name=""Question_type"" type=""hidden"" value=""1""/>"
		I1 "<input name=""Question_view_num"" type=""hidden"" value="""&Order_num&"""/>"
		I1 "<div class=""Question_item_content"">"
		I1 "<li class=""Question_title"">"&Order_num&"、"&rs("Question_content")&"</li>"
		I1 "<ul type=""1"">"
		if not rs("Question_answer")="" then
			if Question_type<>"" then'将题目类型存在变量中，统一POST
				Question_type=Question_type&","&rs("Question_type")
			else 
				Question_type=rs("Question_type")
			end if
			Question_answer=split(rs("Question_answer"),"&")
			Question_img=split(rs("Question_img"),"&")
			for j=0 to ubound(Question_answer)
				I1 "<li><input type=""radio"" name=""answer"&Question_id&""" value="""&j&""">"&Question_answer(j)
				I1 "</li>"
				if Question_img(j)<>"null" then
					I1 "<img src="""&Question_img(j)&""">"
				end if
			next
		else
			I1 "该题目下无选项"'出现此情况，刚可以认为问卷无效，一定是出现异常。
		end if
		I1 "</ul><br/>"
		I1 "</div>"
		Call Question_item_menu_jdtz(menu_Types)
		I1 "</form>"
	I1 "</div>"'end of  class=""Question_item""
case "2"	 
I1 "<div id=""Question_item"&Question_id&""">"
	I1 "<form id=""QuestionForm"" action=""Survey_Show_Jdtz.asp?Survey_id="&Survey_id&"&Action=Show_Question"" method=""post"" onsubmit=""to_submit();"">"
	I1 "<input name=""Question_id"" type=""hidden"" value="""&Question_id&"""/>"
	I1 "<input name=""Question_type"" type=""hidden"" value=""2""/>"
	I1 "<input name=""Question_view_num"" type=""hidden"" value="""&Order_num&"""/>"
	I1 "<div class=""Question_item_content"">"
	I1 "<li class=""Question_title"">"&Order_num&"、"&rs("Question_content")&"</li>"
	I1 "<ul type=""1"">"
	if not rs("Question_answer")="" then
		if Question_type<>"" then'将题目类型存在变量中，统一POST
			Question_type=Question_type&","&rs("Question_type")
		else 
			Question_type=rs("Question_type")
		end if
		Question_answer=split(rs("Question_answer"),"&")
		Question_img=split(rs("Question_img"),"&")
		for j=0 to ubound(Question_answer)
			I1 "<li><input type=""checkbox"" name=""answer"&Question_id&""" value="""&j&""">"&Question_answer(j)
			'I1 "<input type=""hidden"" name=""answer_jdtz"&Question_id&""" value="""&Question_jdtz_arr(j)&""">"
			I1 "</li>"
			if Question_img(j)<>"null" then
				I1 "<img src="""&Question_img(j)&""">"
			end if
		next
	else
		I1 "该题目下无选项"'出现此情况，刚可以认为问卷无效，一定是出现异常。
	end if
	I1 "</ul><br/>"
	I1 "</div>"
	call Question_item_menu_jdtz(menu_Types)
	I1 "</form>"
I1 "</div>"'end of class=""Question_item""
'----------------------------------------------------------
'显示多选+自定义文本类型的题目
'----------------------------------------------------------
case "3"
	I1 "<div id=""Question_item"&Question_id&""">"
		I1 "<form id=""QuestionForm"" action=""Survey_Show_Jdtz.asp?Survey_id="&Survey_id&"&Action=Show_Question"" method=""post"" onsubmit=""to_submit();"">"
		I1 "<input name=""Question_id"" type=""hidden"" value="""&Question_id&"""/>"
		I1 "<input name=""Question_type"" type=""hidden"" value=""3""/>"
		I1 "<input name=""Question_view_num"" type=""hidden"" value="""&Order_num&"""/>"
		I1 "<div class=""Question_item_content"">"
		I1 "<li class=""Question_title"">"&Order_num&"、"&rs("Question_content")&"</li>"
		I1 "<ul type=""1"">"
		if not rs("Question_answer")="" then
			if Question_type<>"" then'将题目类型存在变量中，统一POST
				Question_type=Question_type&","&rs("Question_type")
			else 
				Question_type=rs("Question_type")
			end if
			Question_answer=split(rs("Question_answer"),"&")
			Question_img=split(rs("Question_img"),"&")
			for j=0 to (ubound(Question_answer)-1)
				I1 "<li><input type=""radio"" name=""answer"&Question_id&""" value="""&j&""">"&Question_answer(j)
				'I1 "<input type=""hidden"" name=""answer_jdtz"&Question_id&""" value="""&Question_jdtz_arr(j)&""">"
				I1 "</li>"
				if Question_img(j)<>"null" then
					I1 "<img src="""&Question_img(j)&""">"
				end if
			next'输出最后一个文本类型的
			I1 "<li><input type=""radio"" name=""answer"&Question_id&""" value="""&ubound(Question_answer)&""">"&Question_answer(ubound(Question_answer))&"<input type=""text"" name=""answer"&Question_id&"_2"">"
			'I1 "<input type=""hidden"" name=""answer_jdtz"&Question_id&""" value="""&Question_jdtz_arr(ubound(Question_answer))&""">"
			I1 "</li>"
		else
			I1 "该题目下无选项"'出现此情况，刚可以认为问卷无效，一定是出现异常。
		end if
		I1 "</ul><br/>"
		I1 "</div>"
		call Question_item_menu_jdtz(menu_Types)
		I1 "</form>"
	I1 "</div>"'end of  class=""Question_item""
case "4"
I1 "<div id=""Question_item"&Question_id&""">"
	I1 "<form id=""QuestionForm"" action=""Survey_Show_Jdtz.asp?Survey_id="&Survey_id&"&Action=Show_Question"" method=""post"" onsubmit=""to_submit();"">"		
	I1 "<input name=""Question_id"" type=""hidden"" value="""&Question_id&"""/>"
	I1 "<input name=""Question_type"" type=""hidden"" value=""4""/>"
	I1 "<input name=""Question_view_num"" type=""hidden"" value="""&Order_num&"""/>"
	I1 "<div class=""Question_item_content"">"
	I1 "<li class=""Question_title"">"&Order_num&"、"&rs("Question_content")&"</li>"
	I1 "<ul type=""1"">"
	if not rs("Question_answer")="" then
		if Question_type<>"" then'将题目类型存在变量中，统一POST
			Question_type=Question_type&","&rs("Question_type")
		else 
			Question_type=rs("Question_type")
		end if
		Question_answer=split(rs("Question_answer"),"&")
		Question_img=split(rs("Question_img"),"&")
		for j=0 to (ubound(Question_answer)-1)
			I1 "<li><input type=""checkbox"" name=""answer"&Question_id&""" value="""&j&""">"&Question_answer(j)
			'I1 "<input type=""hidden"" name=""answer_jdtz"&Question_id&""" value="""&Question_jdtz_arr(j)&""">"
			I1 "</li>"
			if Question_img(j)<>"null" then
				I1 "<img src="""&Question_img(j)&""">"
			end if
		next
		I1 "<li><input type=""checkbox"" name=""answer"&Question_id&""" value="""&ubound(Question_answer)&""">"&Question_answer(ubound(Question_answer))&"<input type=""text"" name=""answer"&Question_id&"_2"">"
		'I1 "<input type=""hidden"" name=""answer_jdtz"&Question_id&""" value="""&Question_jdtz_arr(ubound(Question_answer))&""">"
		I1 "</li>"
	else
		I1 "该题目下无选项"'出现此情况，刚可以认为问卷无效，一定是出现异常。
	end if
	I1 "</ul><br/>"
	I1 "</div>"
	call Question_item_menu_jdtz(menu_Types)
	I1 "</form>"	
I1 "</div>"'end of class=""Question_item""
'----------------------------------------------------------
'显示题目类型为问答题的题目
'----------------------------------------------------------
case "5"
I1 "<div id=""Question_item"&Question_id&""">"
	I1 "<form id=""QuestionForm"" action=""Survey_Show_Jdtz.asp?Survey_id="&Survey_id&"&Action=Show_Question"" method=""post"" onsubmit=""to_submit();"">"		
	I1 "<input name=""Question_id"" type=""hidden"" value="""&Question_id&"""/>"
	I1 "<input name=""Question_type"" type=""hidden"" value=""5""/>"
	I1 "<input name=""Question_view_num"" type=""hidden"" value="""&Order_num&"""/>"
	I1 "<div class=""Question_item_content"">"
	I1 "<li class=""Question_title"">"&Order_num&"、"&rs("Question_content")&"</li>"
	I1 "回答："
	I1 "<input type=""text"" name=""answer"&Question_id&"""><br/><br/>"
	if Question_type<>"" then  '将题目类型存在变量中，统一POST
	   Question_type=Question_type&","&rs("Question_type")
	else 
	   Question_type=rs("Question_type")
	end if
	I1 "</div>"
	call Question_item_menu_jdtz(menu_Types)
	I1 "</form>"	
I1 "</div>"'end of class=""Question_item""
'----------------------------------------------------------
'所有题目类型显示完毕
'----------------------------------------------------------
case else
end select
end if
rs.close
'---------------------------------------------------
End Sub




'----------------------------------------------------------
'截断跳转情况下的保存问卷数据过程---start
'特点：讲暂存在cookies中的所有结果统一保存到数据库中。
'----------------------------------------------------------
Sub Save_Survey
Survey_id=request.QueryString("Survey_id")
sql="select * from survey where Survey_id="&Survey_id
rs.open sql,conn,1,3
if rs.eof then
	call ShowAlert("参数错误1","")
else
Survey_content=rs("Survey_content")
end if
rs.close
if Survey_ipRepeat="0" then'对于同一IP不可重复提交的问卷，进行IP验证
	UserIp=request.servervariables("http_x_forwarded_for") 
	if UserIp="" then 
		UserIp=request.servervariables("remote_addr")
	end if
	sql="select * from ip where Ip_survey="&Survey_id&" and Ip_content='"&UserIp&"'"
	rs.open sql,conn,1,3
	if not rs.eof then
		call ShowAlert("对不起，您已经提交过一份问卷，谢谢您的参与！","Index.asp")
	end if
	rs.close
end if
dim Question_result_cookies
Question_list=request.Cookies("Survey_Jdtz")("Question_list")
Question_type_save=request.Cookies("Survey_Jdtz")("Question_type")
Question_result_cookies=request.Cookies("Survey_Jdtz")("Question_result")
Survey_question_save=split(Question_list,"||||")
Question_type_save=split(Question_type_save,"||||")
Question_result_cookies=split(Question_result_cookies,"||||")
'----------------------------------------------------------
'所有题目扫描一遍，为“阶段跳转点分析”功能预留
'----------------------------------------------------------
'for k=0 to ubound(Survey_question_save)'外循环，所有的题目扫描一遍,检验问卷填写是否完整
'	value_d=request.Form("answer"&Survey_question_save(k))
'	if value_d="" then
'		Call ShowAlert("请填写完整再提交","Survey_Show.asp?Survey_id="&Survey_id)
'	end if
'next
for k=0 to ubound(Survey_question_save)'外循环，所有回答过的题目扫描一遍,保存结果
select case Question_type_save(k)
  case "1","2"' 单项和多项选择题的数据保存
	value_d=Question_result_cookies(k)
	if value_d<>"" then
		sql="select Question_result from question where Question_id="&Survey_question_save(k)
		rs.open sql,conn,1,3
		dim Question_result
		Question_result=split(rs("Question_result"),",")
		value_d=split(value_d,"$$$$")
		for each val in value_d
		Question_result(val)=Question_result(val)+1
		next
		for each Qc in Question_result'新结果重新连接成一串数据
			if Question_result_new="" then
			Question_result_new=Qc
			else 
			Question_result_new=Question_result_new&","&Qc
			end if
		next
		application.Lock()
		rs("Question_result")=Question_result_new
		rs.update
		application.UnLock()
		Question_result_new=""
		rs.close
		value_d=""
	end if	
  case "3","4"'单项、多项选择题和文本混合的数据保存
	value_d=Question_result_cookies(k)
	if value_d<>"" then
		sql="select Question_result from question where Question_id="&Survey_question_save(k)
		rs.open sql,conn,1,3
		Question_result=split(rs("Question_result"),",")
		value_d=split(value_d,"$$$$")
		for each val in value_d
		    val_tt=split(val,"::::")
			if cint(val_tt(0))=cint(ubound(Question_result)) then'用户选择了多项选择题和文本混合题型的最后一项
				sqlt="select * from text"
				rst.open sqlt,conn,1,3
				application.Lock()
				rst.addnew
				rst("Text_content")=val_tt(1)
				rst("Text_belong")=Survey_question_save(k)
				rst.update
				application.UnLock()
				rst.close
			end if
		    Question_result(val_tt(0))=Question_result(val_tt(0))+1
		next
		for each Qc in Question_result'新结果重新连接成一串数据
			if Question_result_new="" then
			Question_result_new=Qc
		else 
			Question_result_new=Question_result_new&","&Qc
		end if
		next
		application.Lock()
		rs("Question_result")=Question_result_new
		rs.update
		application.UnLock()
		Question_result_new=""
		rs.close
		value_d=""
	end if	
  case "5"'纯文本的题目的数据保存
	value_d=Question_result_cookies(k)
	if value_d<>"" then
		sql="select * from text"
		rs.open sql,conn,1,3
		application.Lock()
		rs.addnew
		rs("Text_content")=value_d
		rs("Text_belong")=Survey_question_save(k)
		rs.update
		application.UnLock()
		rs.close
		value_d=""
	end if	

end select
next'扫描全部题目结束
'有效问卷加1
sql="select Survey_usehits from survey where Survey_id="&Survey_id
rs.open sql,conn,1,3
application.Lock()
rs(0)=rs(0)+1
rs.update
application.UnLock()
rs.close
if Survey_ipRepeat="0" then'对于同一IP不可重复提交的问卷，记录IP
	UserIp=request.servervariables("http_x_forwarded_for") 
	if UserIp="" then 
	UserIp=request.servervariables("remote_addr")
	end if
	sql="select * from ip"
	rs.open sql,conn,1,3
	application.Lock()
	rs.addnew
	rs("Ip_content")=UserIp
	rs("Ip_survey")=Survey_id
	rs("Ip_date")=date()
	rs.update
	application.UnLock()
	rs.close
end if
session("pass")=""
Call ShowAlert("问卷提交成功!!","Index.asp")
End Sub
'----------------------------------------------------------
'截断跳转情况下的保存问卷数据过程---over
'----------------------------------------------------------

'----------------------------------------------------------
'各种功能过程---start
'----------------------------------------------------------
Sub Question_item_menu_jdtz(menu_Types)
I1 "<div class=""Question_item_menu"">"
Select Case menu_Types
    Case 0
		I1 "<input name=""button_submit"" type=""submit"" value=""下 一 题""/>"
	Case 1
		I1 "<input name=""button_submit"" type=""submit"" value=""提交问卷"" />"
End Select
I1 "</div>"
End Sub

'----------------------------------------------------------
'以字符的形式得到已经完成的那道题目的结果，参数：问题ID，问题类型
'----------------------------------------------------------
Function Get_Question_Result_arrString(Question_id,Question_type)
End Function

'----------------------------------------------------------
'得到某个字符在指定数组中的下标。参数：查找的字符，数组
'----------------------------------------------------------
Function Get_Subscript(text,arr)
    for tt_i=0 to Ubound(arr)
	    if arr(tt_i)=text then
		Get_Subscript=tt_i
		exit for
		end if
	next
End Function
'----------------------------------------------------------
'本页报错提示
'----------------------------------------------------------
Sub Show_Err
I1 "参数错误,请检查问卷ID,或是联系问卷发起单位!"
response.End()
End Sub

'----------------------------------------------------------
'各种功能过程---over
'----------------------------------------------------------

%>